# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Alexander Rødseth <rodseth@gmail.com>
# Contributor: Marcin "avalan" Falkiewicz <avalatron@gmail.com>
# Contributor: C Anthony Risinger <anthony@xtfx.me>

pkgbase=python-ply
pkgname=(python-ply python2-ply)
pkgver=3.11
pkgrel=2
pkgdesc='Implementation of lex and yacc parsing tools'
arch=('any')
url='http://www.dabeaz.com/ply/'
license=('BSD')
makedepends=('python-setuptools' 'python2-setuptools')
source=("${url}ply-$pkgver.tar.gz"
        LICENSE)
sha512sums=('37e39a4f930874933223be58a3da7f259e155b75135f1edd47069b3b40e5e96af883ebf1c8a1bbd32f914a9e92cfc12e29fec05cf61b518f46c1d37421b20008'
            '5cea085a23ed260afc9084380c1d59e3942c2385089a8eb2391a89c85cde4df2ceb7eed21bb8c4d0cad5b78e59742da69e4c5c78fd0e223f5c99c56e9296a075')

prepare() {
  cp -a ply-$pkgver{,-py2}
}

check() {
  cd "ply-$pkgver/test"
  python testlex.py
  python testyacc.py

  cd "$srcdir/ply-$pkgver-py2/test"
  python2 testlex.py
  python2 testyacc.py
}

package_python-ply() {
  depends=('python')

  cd "ply-$pkgver"
  python setup.py install --root="$pkgdir"

  install -Dm644 ../LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

package_python2-ply() {
  depends=('python2')

  cd "ply-$pkgver-py2"
  python2 setup.py install --root="$pkgdir"

  install -Dm644 ../LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

# vim:set ts=2 sw=2 et:
